package io.shallwe._admin.basedata.init;

import com.jfinal.aop.Aop;
import com.jfinal.aop.Inject;
import io.shallwe.common.controller.BaseController;
import io.shallwe.common.model.StaticHanger;

/**
 * 电泳框初始位置信息维护
 * @author 王小伟
 * @date 2019-06-13 21:50:46
 */
public class InitHangerPositionController extends BaseController {

	StaticHangerService service= Aop.get(StaticHangerService.class);
	
	public void index() {
		render("index.html");
	}
	
	
	public void list() {
		Integer offset = getParaToInt("offset", 1);
		Integer pageSize = getParaToInt("pageSize", 100);
		renderJson(service.paginate(offset, pageSize));
	}
	
	public void add() {
		render("add_edit.html");
	}
	
	public void save() {
		StaticHanger rack=getBean(StaticHanger.class,"hanger",true);
		renderJson(service.save(rack));
	}
	

	public void edit() {
		Integer id=getInt("id");
		StaticHanger hanger=service.findById(id);
		set("hanger",hanger);
		render("add_edit.html");
	}

	public void update() {
		StaticHanger hanger=getBean(StaticHanger.class,"hanger",true);
		renderJson(service.update(hanger));
	}
	
	public void delete() {
		Integer id=getInt("id");
		renderJson(service.delete(id));
	}
	
	public void doLocation() {
		renderJson(service.doLocation());
	}
}
